@extends('admin.layout.index')

@section('content')
	<div class="col-md-12">
	    <!-- Advanced Tables -->
	    <div class="card">
	        <div class="card-action">
	            信息列表
	        </div>
	        <div class="card-content">
	            <div class="table-responsive">
	                <div id="dataTables-example_wrapper" class="dataTables_wrapper form-inline"
	                role="grid">
	                    <div class="row"> 
	                    	<form action="/admin/message/index" method="get">
	                       	 	<div class="col-sm-6">
		                            <div class="dataTables_length" id="dataTables-example_length">
		                                <label>
		                                    <select name="count" aria-controls="dataTables-example"
		                                    class="form-control input-sm">
		                                        <option value="10" @if(!empty($request['count']) && $request['count'] == 10) selected @endif >
		                                            10
		                                        </option>
		                                        <option value="15" @if(!empty($request['count']) && $request['count'] == 15) selected @endif>
		                                            15
		                                        </option>
		                                        <option value="20" @if(!empty($request['count']) && $request['count'] == 20) selected @endif>
		                                            20
		                                        </option>
		                                    </select>
		                                    <span style="font-size:13px"></span>
		                                </label>
		                            </div>
		                        </div>
		                        <div class="col-sm-6">
		                            <div id="dataTables-example_filter" class="dataTables_filter">
		                                <label>
		                                   <span style="font-size:16px">关键字:</span>
		                                    <input type="search" name="search" class="form-control input-sm" aria-controls="dataTables-example" value="{{ $request['search'] or '' }}">　　
		                                    <button type="submit" class="btn btn-lg btn-primary" style="font-size:13px"> 搜索 </button>
		                                </label>
		                            </div>
		                        </div>
	                        </form>
	                    </div>
	                    <table class="table table-striped table-bordered table-hover dataTable no-footer"
	                    id="dataTables-example" aria-describedby="dataTables-example_info">
	                        <thead>
	                            <tr role="row">
	                                <th style="text-align:center;">
	                                    ID
	                                </th>
	                                <th style="text-align:center;">
	                                    发件人
	                                </th>
	                                <th style="text-align:center;">
	                                    收件人
	                                </th>
	                                <th style="text-align:center;">
	                                    信息内容
	                                </th>
	                                <th style="text-align:center;">
	                                    发送时间
	                                </th>
	                                <th style="text-align:center;">
	                                    操作
	                                </th>
	                            </tr>
	                        </thead>
	                        <tbody>
		                      	@foreach($data as $k=>$v)
		                            <tr class="gradeA odd">
		                                <td style="text-align:center;">
		                                   	{{ $v['id'] }}
		                                </td>
		                                <td style="text-align:center;">
		                                	@if($v['fuid'])
		                                   		{{ $v['fusername'] }}@if($v['fumerchant']==0)（普通用户）@elseif($v['fumerchant']==1)（店主）@endif
		                                   	@elseif($v['faid'])
		                                   		{{ $v['faid'] }}（管理员）
		                                   	@endif
		                                </td>
		                                <td style="text-align:center;">
		                                @if($v['susername'])
		                                	{{ $v['susername'] }}@if($v['sumerchant']==0)（普通用户）@elseif($v['sumerchant']==1)（店主）@endif
		                                @else
		                                  所有用户 
		                                @endif
		                                </td>
		                                <td style="text-align:center;word-break:break-all;width:30%;line-height:100%">
		                                   	{{ $v['content'] }}
		                                </td>
		                                <td style="text-align:center;">
		                                  	{{ date('Y-m-d H:i:s',$v['time']) }}
		                                </td>
		                                <td style="text-align:center;">
		                                	<a href="/admin/message/delete?id={{ $v['id'] }}" title="删除" onclick="return confirm('你确定要删除该信息吗？')"><i class="material-icons dp48">delete</i></a>　
		                                	<a href="/admin/message/edit?id={{ $v['id'] }}" title="修改" onclick="return confirm('你确定要修改该信息吗？')"><i class="material-icons dp48">mode_edit</i></a>
		                                </td>
		                            </tr>
		                            @endforeach
	                        </tbody>
	                    </table>
	                    <div class="row">
	                        <div class="col-sm-5">
	                            <div class="dataTables_info" id="dataTables-example_info" role="alert"
	                            aria-live="polite" aria-relevant="all">
	                                Showing 1 to 10 of 57 entries
	                            </div>
	                        </div>
	                        <div class="col-sm-7">
	                            <div class="dataTables_paginate paging_simple_numbers" id="dataTables-example_paginate">
	                             	{!! $data->appends($request)->render() !!}
	                            </div>
	                        </div>
	                    </div>
	                </div>
	            </div>
	        </div>
	    </div>
	    <!--End Advanced Tables -->
	</div>
@endsection